package com.qidian.buy.goods.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.qidian.buy.goods.entity.ItemSpecificationItem;
import com.qidian.buy.goods.mapper.ItemSpecificationItemMapper;
import com.qidian.buy.goods.service.IItemSpecificationItemService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.qidian.buy.util.pojo.QdResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 戴着假发的程序员
 * @since 2024-05-08
 */
@Service
public class ItemSpecificationItemServiceImpl implements IItemSpecificationItemService {
    @Autowired
    private ItemSpecificationItemMapper itemSpeMapper;
    @Override
    public QdResult<List<ItemSpecificationItem>> list(Long speId) {
        QueryWrapper<ItemSpecificationItem> wrapper = new QueryWrapper<>();
        wrapper.eq("spe_id",speId);
        return QdResult.success(itemSpeMapper.selectList(wrapper));
    }

    @Override
    public QdResult save(ItemSpecificationItem itemSpecificationItem) {
        return QdResult.isSuccess(itemSpeMapper.insert(itemSpecificationItem));
    }
}
